#include<stdio.h>
#include<math.h>
float atof(char *s)
{
    int result =0;
    int sign=1;
    int count=0;
    int n=0;
    while(*s !='.')
    {
        if(*s=='-')
        {
            sign =-1;
        }
        
        if(*s<='9'&&*s>='0')
        {
            result =result *10+*s-'0';
        }
        s++;
    }
    printf("%d\n",result);
    s++;
    
    while(*s !='\0')
    {
        
        if(*s<='9'&&*s>='0')
        {
            count =count *10+*s-'0';
            n++;
        }
        
        s++;
         
    }
    printf("%d\n",count);


    return sign*((float)result+(float)count/pow(10,n))/10;
}
int main()
{
    char s[]="-31.4112";
    float a=atof(s);
    printf("%f\n",a);
    return 0;
}